import { _decorator, BlockInputEvents, Component, Input, Node, Widget } from 'cc';
const { ccclass, property, requireComponent } = _decorator;

@ccclass('Dialog')
export class Dialog extends Component {
    protected start(): void {
        this.node.on(Input.EventType.TOUCH_END, this.onTouchEnd, this);
    }
    protected onDestroy(): void {
        this.node.off(Input.EventType.TOUCH_END, this.onTouchEnd, this);
    }

    private onTouchEnd() {
        this.close();
    }
    open() {
        this.node.active = true;
    }
    close() {
        this.node.active = false;
    }
    toggle() {
        this.node.active = !this.node.active;
    }
}


